<?php
/**
 * 统计
 */
namespace app\common\model;

use think\Model;
use think\facade\Db;
class Statistics extends Model
{
    /**
     * 更新统计
     * @param $name
     * @param $date_type
     * @param $num
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function up($name,$num){



    }

    public static function getFint($name,$type){
        $date_time = date('Y',time());
        if($type == 1) $date_time = 1;
        if($type == 3) $date_time = date('Y-m',time());

        $where = [
            'name'  =>  $name,
            'date_type' =>  $type,
            'date_time' =>  $date_time
        ];

        return self::where(formatWhere($where))->find();
    }

}